<% layout('/layouts/default.html', {title: '工单主档管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(tpJobmstr.isNewRecord ? '新增工单主档' : '编辑工单主档')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${tpJobmstr}" action="${ctx}/tp/tpJobmstr/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('工单号码')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="fpJobno" maxlength="18" class="form-control required" />

							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('产品系列')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<!--
								<#form:input path="fpSeries" />
								-->
								<#form:select path="fpSeries" maxlength="20" class="form-control required" />

							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('产品型号')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="fpModel" maxlength="25" class="form-control required"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('生产流程模板')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:select path="fpWorkflowTemplate" maxlength="25" class="form-control required"/>
							</div>
						</div>
					</div>

				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('计划产量')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="fpTarqty" class="form-control required digits"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required ">*</span> ${text('站位顺序检查')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:radio path="fpChkProdSeq" dictType="YesNo" class="form-control required" />
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('客户')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="fpCust" maxlength="50" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('牌子')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="fpBrand" maxlength="25" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('销售地区/国家')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="fpDelcnty" maxlength="10" class="form-control"/>
							</div>
						</div>
					</div>
					<div class="col-xs-6">
						<div class="form-group">
							<label class="control-label col-sm-4" title="">
								<span class="required hide">*</span> ${text('完成日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-8">
								<#form:input path="fpFinishDt" readonly="true" maxlength="20" class="form-control Wdate"
									dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:true});"/>
							</div>
						</div>
					</div>
				<#form:hidden path="id"/>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('图片上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadImage" bizKey="${tpJobmstr.id}" bizType="tpJobmstr_image"
									uploadType="image" class="" readonly="false"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2">${text('附件上传')}：</label>
							<div class="col-sm-10">
								<#form:fileupload id="uploadFile" bizKey="${tpJobmstr.id}" bizType="tpJobmstr_file"
									uploadType="all" class="" readonly="false"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('tp:tpJobmstr:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script src="${ctxStatic}/app/pms_app.js?${_version}"></script>
<script>
	mFieldsToUpper="fpJobno".split(",");
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
$(document).ready(function(){
	app.setSeriesSelection($("#fpSeries"));
	app.setModelSelection($("#fpModel"),function(){
		return $("#fpSeries").val();
	});
	app.setWorkFlowSelection($("#fpWorkflowTemplate"));
	var lvsSeries="${tpJobmstr.fpSeries}";
	var lvsModel="${tpJobmstr.fpModel}";
	$("<option value='{0}' >{0}</option>".format(lvsSeries)).appendTo($("#fpSeries"));
	//$("#fpSeries").select2().trigger("change");
	$("<option value='{0}' >{0}</option>".format(lvsModel)).appendTo($("#fpModel"));
	$("<option value='{0}' >{0}</option>".format("${tpJobmstr.fpWorkflowTemplate}")).appendTo($("#fpWorkflowTemplate"));
	//$("#fpModel").select2().trigger("change");
	$("#inputForm input").blur(function(){
		$(this).val($(this).val().toUpperCase().trim());
	});

})

</script>